
public abstract class Employee {

    private static int counterId = 0;
    private String name;
    private int id;
    private boolean inStaff;

    Employee(String name) {
        this.name = name;
        this.id = counterId;
        this.inStaff = false;
        counterId++;
    }

    public abstract double calculateSalary();

    @Override
    public boolean equals(Object otherObject) {
        if (this == otherObject) {
            return true;
        }
        if (otherObject == null) {
            return false;
        }
        if (getClass() != otherObject.getClass()) {
            return false;
        }
        Employee other = (Employee) otherObject;
        return name.equals(other.name) && id == other.id;
    }

    @Override
    public int hashCode() {
        return 7 * name.hashCode()
                + 11 * new Integer(id).hashCode();
    }

    public static int getCounterId() {
        return counterId;
    }

    public void setInStaff(boolean inStaff) {
        this.inStaff = inStaff;
    }

    public boolean isInStaff() {
        return inStaff;
    }

    public int getId() {
        return id;
    }

    public String getName() {
        return name;
    }
}
